package com.ieasy.module.oa.project.web.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ieasy.basic.model.DataGrid;
import com.ieasy.basic.model.Msg;
import com.ieasy.module.common.web.action.BaseController;
import com.ieasy.module.oa.project.service.IPositionQuotienService;
import com.ieasy.module.oa.project.web.form.PosistionQuotientReportForm;

@Controller
@RequestMapping("/admin/oa/position_quotient")
public class PositionQuotientAction extends BaseController {
	
	@Autowired
	private IPositionQuotienService positionQuotienService ;
	
	/**
	 * 计算岗位人月
	 * 公式(岗位人月 * 岗位系数)
	 * @param form
	 * @return
	 */
	@RequestMapping("/datagrid.do")
	public @ResponseBody DataGrid datagrid(PosistionQuotientReportForm form) {
		return this.positionQuotienService.datagrid(form) ;
	}
	
	@RequestMapping("/updatePositionQuotient.do")
	public @ResponseBody Msg updatePositionQuotient(PosistionQuotientReportForm form) {
		this.positionQuotienService.updatePositionQuotient(form) ;
		return new Msg(true) ;
	}
	
	/**
	 * 根据项目ID和年份清除数据
	 * @param form
	 * @return
	 */
	@RequestMapping("/deleteByProjectYear.do")
	public @ResponseBody Msg deleteByProjectYear(PosistionQuotientReportForm form) {
		return this.positionQuotienService.deleteByProjectYear(form) ;
	}
	
	@RequestMapping("/calByQuotient.do")
	public @ResponseBody DataGrid calByQuotient(PosistionQuotientReportForm form) {
		return this.positionQuotienService.calByQuotient(form) ;
	}

}
